
#ifndef _EVENT_H__INCLUDED_
#define _EVENT_H__INCLUDED_

#include "Utility/ErrorCode.h"
#include <memory>

#ifndef INFINITE
#define INFINITE 0xFFFFFFFF
#endif

namespace nebula { namespace utility {

class EventImpl;

class Event
{
public:
	explicit Event(bool init_state=false);
	~Event();

public:
	void set();
	void clear();
	bool is_set() const;
	NEBULA_ERROR_CODE wait(unsigned long timeout = INFINITE); // timeout in milliseconds

private:
	Event(const Event &); // not implemented
	Event& operator= (const Event &); // not implemented

private:
	std::auto_ptr<EventImpl> pImpl;
};

}} // namespace nebula::utility

#endif // _EVENT_H__INCLUDED_

